package com.ingsing.user.service.impl;

import com.ingsing.user.model.po.User;
import com.ingsing.user.mapper.UserMapper;
import com.ingsing.user.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author: NALHOUG
 * @time: 2019/10/31 15:31
 * @explain:
 */
@Service
public class UserServiceImpl implements IUserService {

    @Resource
    private UserMapper userMapper;


    @Override
    public int insertSelective(User user) {
        return userMapper.insert(user);
    }

    @Override
    public User selectByUsername(String username) {
        return userMapper.selectByUsername(username);
    }

    @Override
    public User selectByEmail(String email) {
        return userMapper.selectByEmail(email);
    }

    @Override
    public User selectByPhone(String phone) {
        return userMapper.selectByPhone(phone);
    }

    @Override
    public int offAccount(Integer userId) {
        return offAccount(userId);
    }

    @Override
    public int disableAccount(Integer userId) {
        return disableAccount(userId);
    }

    @Override
    public int abnormalAccount(Integer userId) {
        return abnormalAccount(userId);
    }

    @Override
    public void setLastLogin(Integer userId) {
        userMapper.setLastLogin(userId);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.update(user,null);
    }
}
